#include "tcp_server.hpp"
#include <memory>
using namespace ns_tcpserver;

void usage(std::string proc)
{
    std::cout << "usage:\n\t" << proc << " serverport" << std::endl;
}

std::string echo(std::string str)
{  
    std:: cout << "server.cc::echo..."  << std:: endl;
    return str;
}
int main(int argc, char *argv[])
{
    // std::cout << "hello tcp_server" << std:: endl;
    if (argc != 2)
    {
        usage(argv[0]);
        exit(USAGE_ERR);
    }
    uint16_t port = atoi(argv[1]);
    std::unique_ptr<tcpServer> tsvr(new tcpServer(echo,port));
    tsvr->initServer();
    tsvr->start();
    return 0;
}